#include "ProjectManager/qprojectview.h"

/********************************************
 *              Public
 ********************************************/

    /********************************************
     *              Constructors
     ********************************************/

        QProjectView::QProjectView()
        {
            // Je dis à Qt que la vue a un menu contextuel
            setContextMenuPolicy(Qt::CustomContextMenu);
        }

    /********************************************
     *              Methods
     ********************************************/

/********************************************
 *              Private
 ********************************************/

    /********************************************
     *              Methods
     ********************************************/

        void QProjectView::contextMenuEvent(QContextMenuEvent *e)
        {

        }

        void QProjectView::CustomMenu(QPoint pos)
        {
            QStandardItemModel * standardModel =(QStandardItemModel * ) model();

            ComponentItem * comp = ((ComponentItem *)(standardModel->itemFromIndex(indexAt(pos))));

            if(comp != NULL)
            {
                QAction * selected = comp->m_Component->GetContextualMenu()->exec(QCursor::pos());

                if(selected !=NULL)
                {
                    comp->m_Component->ExeContextualMenu(selected);
                }
            }
        }
